package com.alisoft.nano.seda;

import java.util.concurrent.TimeUnit;

/**
 * The exception will be thrown if time is out when posting the event to a stage or event machine. 
 * 
 * @author zhimin.chenzm
 *
 */
public class TimeoutException extends StageRuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7768108923108942559L;

	private final String stageName;
	private final long timeout;
	private final TimeUnit unit;

	public TimeoutException(String stageName, long timeout, TimeUnit unit) {
		super("Time (" + timeout + " " + unit
				+ ") is out when posting the event to stage " + stageName);
		this.stageName = stageName;
		this.timeout = timeout;
		this.unit = unit;
	}

	public String getStageName() {
		return stageName;
	}

	public long getTimeout() {
		return timeout;
	}

	public TimeUnit getUnit() {
		return unit;
	}

}
